<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script th:src="@{/js/jquery-3.4.1.js}"></script>
    <link rel="stylesheet" href="../../static/css/bootstrap.4.3.1.min.js.css" th:href="@{/css/bootstrap.4.3.1.min.js.css}"/>
    <link rel="stylesheet" href="../../static/css/layui.css" th:href="@{/css/layui.css}"/>
    <script th:src="@{/js/layui.js}"></script>
    <script th:src="@{/js/modules/layer.js}"></script>
</head>
<body>
<div class="container">
    <br>
    <h4 style="text-align: center">请确认是否删除该记录？</h4>
    <br>
    <button style="margin-left: 30%" class="btn btn-danger" onclick="click456()">确认删除</button>
</div>
<script>
    //删除选中记录
    function click456(){
        var id = [[${id}]];
        $.ajax({
            url: '/deleteWater',//后台接口地址
            type:'get',
            dataType:'text',
            cache:false,
            async:false,
            data:{
                id:id
            },
            success:function (data) {
                debugger
                console.log(data.msg)
                if(data== "0"){
                    alert("删除成功")
                }else{
                    alert("删除失败")
                }
                parent.layer.closeAll();//关闭所有的弹窗
                parent.location.reload();
            },
            error:function () {
                alert("请求失败")
            }
        })
        // }

    }
</script>
</body>
</html>